home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Extras / IFF / IFF_Forms / YUVN.doc < prev   
Encoding:
Text File  |  1993-03-01  |  8.4 KB  |  232 lines

  1. For storage of Y:U:V image data (MacroSystem)
  2.  
  3.  
  4. yuvn.doc:
  5. ---------------------------------------------------------------------------
  6.                                  FORM YUVN
  7.                                developed by:
  8.                   MS MacroSystem Computer GmbH (Germany)
  9.                               Henning Friedl
  10.                                  (18.4.92)
  11. ---------------------------------------------------------------------------
  12. FORM YUVN
  13.  
  14. The IFF-format YUVN is designed to store YUV-pictures which mainly are used
  15. in  broadcast  television.   YUVN  supports CCIR-601-2 which is a worldwide
  16. standard for PAL- and NTSC-television.
  17.  
  18. ---------------------------------------------------------------------------
  19. Chunk 'YCHD'
  20.  
  21. The  required property 'YCHD' holds a header which describes the dimensions
  22. of  the  image and some other information which are necessary to understand
  23. the data in the following data-chunks.  The chunk 'YCHD' must appear before
  24. the first data-chunk ('DATY').
  25.  
  26. You will find all definitions of this chunk in the file 'yuvn.i'.
  27.  
  28. ---------------------------------------------------------------------------
  29.  
  30. Explanations on the components of the chunk 'YCHD':
  31.  
  32.  
  33. ychd_Width
  34.  
  35. ychd_Width  indicates  the  width of the stored image.  Using YUV_MODE_411,
  36. the width must be a multiple of four, usind YUV_MODE_422 or YUV_MODE_211 it
  37. must  be a multiple of two!  Using YUV_MODE_444, YUV_MODE_400, YUV_MODE_222
  38. or YUV_MODE_200 width may be any value.
  39.  
  40. The  number  of U- and V-pixels per line depends on the used YUV_MODE.  See
  41. the table below for details.
  42.  
  43.             Mode             |    Y-pixels    |    U-pixels    |    V-pixels
  44. -----------------------------+----------------+----------------+---------------
  45. YCHD_MODE_400, YCHD_MODE_200 | ychd_Width     |       -        |       -
  46. YCHD_MODE_411                | ychd_Width (4) | ychd_Width / 4 | ychd_Width / 4
  47. YCHD_MODE_422, YCHD_MODE_211 | ychd_Width (2) | ychd_Width / 2 | ychd_Width / 2
  48. YCHD_MODE_444, YCHD_MODE_222 | ychd_Width     |   ychd_Width   |   ychd_Width
  49.  
  50. (2) means, in this mode ychd_Width MUST be a multiple of two!
  51. (4) means, in this mode ychd_Width MUST be a multiple of four!
  52.  
  53.  
  54. ychd_Height
  55.  
  56. ychd_Height  indicates  the  height  (number  of  rows) of the image.  If a
  57. full-frame picture is stored, ychd_Height must be a multiple of two!
  58.  
  59.  
  60. ychd_PageWidth, ychd_PageHeight
  61.  
  62. These  fields describe the dimensions of the source page.  The image itself
  63. can  be  smaller  or  larger.   If  not  used,  set  this to ychd_Width and
  64. ychd_Height.
  65.  
  66.  
  67. ychd_LeftEdge, ychd_TopEdge
  68.  
  69. These  fields  indicate  the  desired  position  of  this  image within the
  70. destination picture.  If not used, set to 0,0.
  71.  
  72.  
  73. ychd_xAspect, ychd_yAspect
  74.  
  75. The aspect ratio of a single pixel in the stored image.  If you do not know
  76. the correct values (you should know them) use the following:
  77.  
  78. PAL-nonlace:   22/44           NTSC-nonlace:  22/52
  79. PAL-lace:      22/22           NTSC-lace:     22/26
  80.  
  81. See also: 'Finding the Aspect Ratio' by Carolyn Scheppner (AmigaMail 9/10-91)
  82.  
  83.  
  84. ychd_Compress
  85.  
  86. Type of compression.  0, if none.
  87.  
  88.  
  89. ychd_Flags
  90.  
  91. Different  Flags.  Currently only bit-0 (YCHDB_LACE) is defined.  It should
  92. be  set if the stored image has been a full-frame image within an interlace
  93. video-source (TV, VTR, ...).
  94.  
  95.  
  96. ychd_Mode
  97.  
  98. The type of YUV-format.  If you only want to save the luminance information
  99. (black-and-white)   set  ychd_Mode  to  YCHD_MODE_400.   If  you  save  the
  100. additional color-difference-signals U and V set ychd_Mode to YCHD_MODE_411,
  101. YCHD_MODE_422  or  YCHD_MODE_444  depending  what  format you want to save.
  102. With lores-pictures use YCHD_MODE_200, YCHD_MODE_211 or YCHD_MODE_222.
  103.  
  104.  
  105. ychd_Norm
  106.  
  107. Information  on  the TV-system you got this picture from.  If you really do
  108. not  know  set ychd_Norm to YCHD_NORM_UNKNOWN.  The better way is to set it
  109. to the correct value YCHD_NORM_PAL or YCHD_NORM_NTSC!
  110.  
  111. ---------------------------------------------------------------------------
  112.  
  113. The data-chunks DATY, DATU and DATV
  114.  
  115. In  the  IFF-file the chunks DATY, DATU and DATV must appear in this order.
  116. The optional chunks DATU and DATV are both needed in color-pictures.
  117.  
  118.  
  119. The data-chunk DATY
  120.  
  121. The  chunk  DATY  contains the luminance-data (Y) of the YUV-picture.  Each
  122. pixel  is stored in one byte (8 bits), the values follow the CCIR-standard.
  123. Y  ranges  from  16 (black) to 235 (white).  Isolated pixels may go lightly
  124. beyond the limits but 0 and 255 must not appear!
  125.  
  126. The number of pixels in one line is given in ychd_Width.  One line directly
  127. follows  the  other,  there  are  no  pad-bytes  between  two lines even if
  128. ychd_Width  is odd.  Only at the end of the chunk a pad-byte ($00) might be
  129. inserted according the IFF guidelines.
  130.  
  131. Within  a  full-frame- (interlaced-) picture the lines are ordered as if it
  132. was  a  non-lace  picture  (first line, first frame then first line, second
  133. frame  then second line first frame, ...).  This is the same in IFF-ILBM or
  134. the order of the bitmaps in Amiga-memory.
  135.  
  136.  
  137. The data-chunks DATU and DATV
  138.  
  139. The   chunks   DATU   and  DATV  are  optional,  they  have  to  appear  in
  140. color-pictures because they contain the color-difference-signals.
  141.  
  142. Each  pixel  is  stored  in  one  byte  (8  bits),  the  values  follow the
  143. CCIR-standard.   The  values  range  from  16  to  240  (128 means 0).  For
  144. calculations you have to subtract 128 so U or V are in a range from -112 to
  145. 112  where  0  means  no  color.  Isolated pixels may go lightly beyond the
  146. limits but 0 and 255 must not appear!
  147.  
  148. ---------------------------------------------------------------------------
  149.  
  150.  
  151. yuvn.i:
  152. ---------------------------------------------------------------------------
  153.  
  154.  
  155.                IFND      YUVN_I
  156. YUVN_I         SET       1
  157. ;---------------------------------------------------------------------------
  158.              IFND        EXEC_TYPES_I
  159.                INCLUDE   "exec/types.i"
  160.              ENDC
  161. ;---------------------------------------------------------------------------
  162. ;---- ID's used in FORM YUVN
  163.  
  164. ID_YUVN:       equ       'YUVN'             ;the FORM-ID
  165. ID_YCHD:       equ       'YCHD'             ;the header-chunk-ID
  166. ID_DATY:       equ       'DATY'             ;the Y-data-chunk-ID
  167. ID_DATU:       equ       'DATU'             ;the U-data-chunk-ID
  168. ID_DATV:       equ       'DATV'             ;the V-data-chunk-ID
  169.  
  170. ;---- values for ychd_Compress
  171.  
  172. COMPRESS_NONE  equ       0                  ;no comression
  173.  
  174. ;---- values for ychd_Flags
  175.  
  176. YCHDB_LACE     equ       0                  ;if set the data-chunks contain
  177. YCHDF_LACE     equ       1                  ;a full-frame (interlaced) picture
  178.  
  179. ;---- values for ychd_Mode
  180.  
  181. YCHD_MODE_400     equ    0       ;a black-and-white picture (no DATU and DATV)
  182. YCHD_MODE_411     equ    1       ;a YUV-411 picture
  183. YCHD_MODE_422     equ    2       ;a YUV-422 picture
  184. YCHD_MODE_444     equ    3       ;a YUV-444 picture
  185.  
  186. YCHD_MODE_200     equ    8       ;a lores black-and-white picture
  187. YCHD_MODE_211     equ    9       ;a lores color picture (422, but lores)
  188. YCHD_MODE_222     equ    10      ;a lores color picture (444, but lores)
  189.  
  190. YCHD_MODEB_LORES  equ    3       ;test this bit to check for lores/hires
  191. YCHD_MODEF_LORES  equ    8
  192.  
  193. ;---- values for ychd_Norm
  194.  
  195. YCHD_NORM_UNKNOWN equ    0       ;unknown, try to avoid this
  196. YCHD_NORM_PAL     equ    1       ;PAL 4.433 MHz
  197. YCHD_NORM_NTSC    equ    2       ;NTSC 3.579 MHz
  198.  
  199. ;---- the FORM-YUVN DataHeader: 'YCHD'
  200.  
  201.  STRUCTURE __YCHD_Header,0
  202.  
  203.                UWORD     ychd_Width        ;picture width in Y-pixels
  204.                UWORD     ychd_Height       ;picture height (rows)
  205.  
  206.                UWORD     ychd_PageWidth    ;source page width & height,
  207.                UWORD     ychd_PageHeight   ;  normally same as Width and Height
  208.  
  209.                UWORD     ychd_LeftEdge     ;position within the source page,
  210.                UWORD     ychd_TopEdge      ;  normally 0,0
  211.  
  212.                UBYTE     ychd_AspectX      ;pixel aspect (width : height)
  213.                UBYTE     ychd_AspectY      ;
  214.                UBYTE     ychd_Compress     ;(see above)
  215.                UBYTE     ychd_Flags        ;(see above)
  216.  
  217.                UBYTE     ychd_Mode         ;(see above)
  218.                UBYTE     ychd_Norm         ;(see above)
  219.  
  220.                WORD      ychd_reserved2    ;must be 0
  221.  
  222.                LONG      ychd_reserved3    ;must be 0
  223.  
  224.                LABEL     ychd_SIZEOF
  225. ;---------------------------------------------------------------------------
  226. ; Warning, the UBYTE fields are byte-packed, C-compilers should not add pad
  227. ; bytes!
  228. ;---------------------------------------------------------------------------
  229.  
  230.                ENDC      ; YUVN_I
  231.  
  232.